package wang.define;

import java.util.Scanner;

public class MethodDemo2 {
    public static void main(String[] args) {
        //目标： 输出1-n的和
        System.out.println(sum(10));
        //判断一个数是奇数还是偶数
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字");
        int n= sc.nextInt();
        num(n);
    }
    public static int sum(int n){
        int sum = 0;
        for (int i = 1; i <=n ; i++) {
              sum+=i;
        }
        return sum;
    }
    public static void num(int m){
        if (m%2==0){
            System.out.println("这个数是偶数");
        }else System.out.println("这个数是奇数");
    }
}
